﻿using System;

namespace JTLeigh.Commerce.Spencer.Features.ProductFeedback.Business
{

	/// <summary>
	/// Counter used to count boolean values.
	/// </summary>
	public class BooleanCounter
	{

		#region Fields

		private int _positiveCount;
		private int _count;

		#endregion // Fields

		#region Properties

		/// <summary>
		/// Gets the count of the values that have been added.
		/// </summary>
		public int Count
		{
			get { return _count; }
		}

		/// <summary>
		/// Gets the count of the number of positive values that have been added.
		/// </summary>
		public int PositiveCount
		{
			get { return _positiveCount; }
		}

		#endregion // Properties

		#region Methods

		/// <summary>
		/// Adds a value.
		/// </summary>
		/// <param name="value">The <see cref="Boolean"/> value to add.</param>
		public virtual void AddValue(bool value)
		{
			_positiveCount += (value ? 1 : 0);
			_count++;
		}

		/// <summary>
		/// Resets the counter.
		/// </summary>
		public virtual void Reset()
		{
			_positiveCount = 0;
			_count = 0;
		}

		#endregion // Methods

	}

}
